package cn.shop.merchant.model;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;

/**
 * @author : 李一涵
 * @date : Created in 2021-11-3 17:44
 * @description : 基础实体类
 */
public class BaseEntity {

    private Long id;
    @TableField(fill = FieldFill.INSERT)
    private Long uid;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT, select = false)
    private Long createId;
    @TableField( fill = FieldFill.INSERT_UPDATE, select = false)
    private LocalDateTime updateTime;
    @TableField( fill = FieldFill.INSERT_UPDATE, select = false)
    private Long updateId;
    @TableLogic
    private boolean deleted;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUid() {
        return uid;
    }

    public void setUid(Long uid) {
        this.uid = uid;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Long getCreateId() {
        return createId;
    }

    public void setCreateId(Long createId) {
        this.createId = createId;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }

    public Long getUpdateId() {
        return updateId;
    }

    public void setUpdateId(Long updateId) {
        this.updateId = updateId;
    }

    public boolean isDeleted() {
        return deleted;
    }

    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }

    public boolean hasId() {
        return id != null && id > 0;
    }

    @Override
    public String toString() {
        return "BaseEntity{" +
                "id=" + id +
                ", uid=" + uid +
                ", createTime=" + createTime +
                ", createId=" + createId +
                ", updateTime=" + updateTime +
                ", updateId=" + updateId +
                ", deleted=" + deleted +
                '}';
    }
}
